<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>编辑图书信息</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            line-height: 1.6;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            border: 1px solid #ddd;
            border-radius: 5px;
            background-color: #f9f9f9;
        }
        h1 {
            text-align: center;
            color: #333;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }
        input[type="text"], input[type="number"] {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .checkbox-group {
            display: flex;
            align-items: center;
        }
        .checkbox-group input {
            width: auto;
            margin-right: 10px;
        }
        .btn {
            background-color: #4CAF50;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }
        .btn:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>编辑图书信息</h1>
    <!-- 表单1：头像上传 -->
    <div class="upload-section">
        <span>图书封面：</span>
        <img src="${book.cover}" alt="图书封面">
        <form id="avatarForm" action="book.do?action=upload" enctype="multipart/form-data" method="post">
            <input type="hidden" name="id" value="${book.id}">
            <input style="border: 1px solid red" name="file" type="file"><button id="btnAvatar">上传封面</button>
        </form>
    </div>

    <form action="/book.do?action=updateBook" method="post">
        <input type="hidden" name="id" value="${book.id}">

        <div class="form-group">
            <label for="title">书名:</label>
            <input type="text" id="title" name="title" value="${book.title}" required>
        </div>

        <div class="form-group">
            <label for="author">作者:</label>
            <input type="text" id="author" name="author" value="${book.author}" required>
        </div>

        <div class="form-group checkbox-group">
            <label for="available">是否可借:</label>
            <input type="checkbox" id="available" name="available" ${book.available ? 'checked' : ''}>
        </div>

        <div class="form-group">
            <button type="submit" class="btn">保存更改</button>
        </div>
    </form>
</div>
</body>
</html>